package com.vegetable.modules.entity.finance.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * 交易流水与付款记录匹配关系 VO
 * </p>
 *
 * @author Qoder
 * @since 2025-11-02
 */
@Data
@ApiModel(value="TransactionPaymentMatchVO对象", description="交易流水与付款记录匹配关系视图对象")
public class TransactionPaymentMatchVO {

    @ApiModelProperty(value = "主键ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @ApiModelProperty(value = "交易流水ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long transactionId;

    @ApiModelProperty(value = "付款记录ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long paymentId;

    @ApiModelProperty(value = "匹配金额")
    private BigDecimal matchAmount;

    @ApiModelProperty(value = "匹配时间")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date matchTime;

    @ApiModelProperty(value = "付款记录信息")
    private PaymentPurchaseVO paymentInfo;


    @ApiModelProperty(value = "交易唯一ID")
    private String tradingNo;

    @ApiModelProperty(value = "商户订单号")
    private String orderNo;

    @ApiModelProperty(value = "交易时间")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date tradingTime;

    @ApiModelProperty(value = "交易金额")
    private BigDecimal tradingAmount;

    @ApiModelProperty(value = "账户逾额")
    private BigDecimal balanceAmount;

    @ApiModelProperty(value = "手续费")
    private String fee;

    @ApiModelProperty(value = "交易类型")
    private String tradingType;

    @ApiModelProperty(value = "交易状态")
    private String status;

    @ApiModelProperty(value = "支付渠道")
    private String channel;

    @ApiModelProperty(value = "对方银行名称")
    private String bankName;

    @ApiModelProperty(value = "对方银行卡ID")
    private String bankNo;

    @ApiModelProperty(value = "商户ID")
    private String merchantId;

    @ApiModelProperty(value = "交易对手方")
    private String counterparty;

    @ApiModelProperty(value = "交易描述")
    private String tradingDescription;

    @ApiModelProperty(value = "关联账户id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long fundAccountId;

    @ApiModelProperty(value = "关联账户名称")
    private String fundAccountName;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "流水归属id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long abId;

    @ApiModelProperty(value = "流水归属名称")
    private String abName;

    @ApiModelProperty(value = "系统人员添加的描述")
    private String sysRemark;

    @Data
    @ApiModel(value="PaymentPurchaseVO对象", description="付款记录视图对象")
    public static class PaymentPurchaseVO {
        @ApiModelProperty(value = "主键ID")
        @JsonSerialize(using = ToStringSerializer.class)
        private Long id;

        @ApiModelProperty(value = "生产者ID")
        @JsonSerialize(using = ToStringSerializer.class)
        private Long producerId;

        @ApiModelProperty(value = "单据编号")
        private String docNo;

        @ApiModelProperty(value = "付款状态 0结账未付，1实际已付")
        private Integer state;

        @ApiModelProperty(value = "审批状态 0未提交审批，1审批中，2审批通过，3审批拒绝")
        private Integer approvalState;

        @ApiModelProperty(value = "状态0采购付款，1代办付款")
        private Integer orderType;

        @ApiModelProperty(value = "农户代办ID")
        @JsonSerialize(using = ToStringSerializer.class)
        private Long customerId;

        @ApiModelProperty(value = "农户代办名称")
        private String customerName;

        @ApiModelProperty(value = "账户id")
        @JsonSerialize(using = ToStringSerializer.class)
        private Long accountId;

        @ApiModelProperty(value = "账户名称")
        private String accountName;

        @ApiModelProperty(value = "订单时间")
        @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
        private Date orderTime;

        @ApiModelProperty(value = "结账区间开始")
        @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
        private Date startTime;

        @ApiModelProperty(value = "结账区间结束")
        @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
        private Date endTime;

        @ApiModelProperty(value = "金额")
        private BigDecimal money;

        @ApiModelProperty(value = "折扣金额")
        private BigDecimal discount;

        @ApiModelProperty(value = "全局折扣金额")
        private BigDecimal globalDiscount;

        @ApiModelProperty(value = "打款时间")
        @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
        private Date remitTime;

        @ApiModelProperty(value = "备注")
        private String remark;

        @ApiModelProperty(value = "创建者ID")
        private Long createUserId;

        @ApiModelProperty(value = "创建时间")
        @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
        private Date createTime;

        @ApiModelProperty(value = "商品名拼接")
        private String finishCommodityNames;
    }
}